home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2510.ZIP
/
TRSOURCE.EXE
/
SEGMENT.ASM
< prev
next >
Wrap
Assembly Source File
|
1990-10-22
|
2KB
|
69 lines
; SEGMENT.ASM
;
; by Ralph Davis, Leonard Zerman
;
; Placed in the public domain by Tom Rettig Associates, 10/22/1990.
;
PUBLIC _SEGMENT
EXTRN __TR_HEXASM:FAR
;===================
IN_PARMS STRUC
BP_OLD DW ?
RET_ADDR DD ?
IN_VAR DD ? ; Variable we want the segment of
OUT_VAR DD ? ; Variable to return segment in
; must be 4-byte character variable
; (not including null terminator)
IN_PARMS ENDS
;===================
;************************************
_TEXT SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:_TEXT
;------------------------------------
_SEGMENT PROC FAR
PUSH BP
MOV BP,SP
PUSH DS
PUSH ES
PUSH AX
PUSH BX
PUSH CX
PUSH SI
PUSH DI
LDS SI,[BP].IN_VAR
LES DI,[BP].OUT_VAR
XOR SI,SI
PUSH SI ; pass 0 as first parameter
PUSH DS ; push segment address
CALL __TR_HEXASM ; Returns address of hex string
; in AX:BX
ADD SP,4 ; discard parms from stack
MOV DS,DX ; set up registers to return segment
MOV SI,AX ; DX=segment; AX=offset
MOV CX,4
REP MOVSB ; return segment address
POP DI
POP SI
POP CX
POP BX
POP AX
POP ES
POP DS
POP BP
RET
_SEGMENT ENDP
;------------------------------------
_TEXT ENDS
;*****************************************
END